package com.framework.minio.config;

import io.minio.MinioClient;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;

/**
 * @create 2021/4/9
 */
@AllArgsConstructor
public class MinioAutoConfiguration {

    @Autowired
    private MinioConfig miniConfig;

    @Bean
    public MinioClient minioClient()  {
        MinioClient client = MinioClient.builder()
                .endpoint(miniConfig.getEndpoint())
                .credentials(miniConfig.getAccessKey(), miniConfig.getSecretKey())
                .build();
        return  client;
    }

}
